<?php
class traceorder extends control
{
    /* 构造函数。*/
    public function __construct()
    {
        parent::__construct('');
    }
    
    public function index(){
    	//$this->assign();
    	$this->display();
    }
    
    public function search($ordcode){
    	
    	$data = $this->traceorder->search($ordcode);
    	$this->assign('data', $data);
    	$this->display();
    }
    
    public function add(){
    	date_default_timezone_set('Asia/Shanghai');
    	
    	$data = '';
    	$filterarr = array('ordcode', 'status', 'address', 'tracetime');
    	$setarr = array();
    	if(empty($_POST)){
    		
    	}else{
    		//$data = $_POST;
    		foreach ($_POST as $k=>$v){
    			if(in_array($k, $filterarr)){
    				$setarr[$k] = $v;
    			}
    		}
    		$setarr['createtime'] = date("Y-m-d H:i:s");
    		$data = $this->traceorder->add($setarr);
    	}
    	$this->assign('tracetime', date("Y-m-d H:i:s"));
    	$this->assign('data', $data);
    	$this->display();
    }
    
    
    public function findall(){
    	$data = '';
    	$data = $this->traceorder->findAll();
    	$this->assign('data', $data);
    	$this->display();
    }

}
